import Sprite from '../../utils/canvas/sprite.js';
import * as Painter from '../../utils/canvas/painter.js';

export const bg = new Sprite('背景', Painter.bgPainter, []);
export const pic = new Sprite('图片', Painter.picPainter, []);
export const content = new Sprite('文字', Painter.textPainter, []);
export const title = new Sprite('标题', Painter.textPainter, []);

// 画布参数
const canvasW = Math.round(1500);
const canvasH = Math.round(1000);
const cxt_bg = 350 ;// 画布宽度
const bg_w = Math.round(canvasW * .8);// 卡片宽度

let left = Math.round(canvasW / 2) - Math.round(bg_w/1.8);

// console.log(left, '--');

// 背景属性设置
bg.setAttr({
  left: left,
  top: 10,
  width: bg_w,
  height: Math.round(canvasH * .6)
});

// 标题文字属性设置
title.setAttr({
  left: left + bg_w / 2.5,
  top:30,
  width: bg_w / 2,
  text: '不能说的秘密'
});

// 图片对象属性设置
pic.setAttr({
  left: left,
  top: 80,
  width: bg_w/2,
  height: Math.round(bg_w / 1.3),
});

// 文字对象属性设置
content.setAttr({
  left: left + bg_w / 1.8,
  top: Math.round(canvasH * .535),
  width: bg_w / 2,
  text: '-- 桂纶镁'
});
